import React from 'react'
import { Empty } from 'antd-mobile'
import { $pre } from "../../../../http/http";
import "./NewComers.less"
import { withRouter } from 'react-router-dom'

function NewComers(props) {
    let { newcomers } = props
    // console.log('newcomers',newcomers);
    return (
        <div className='new_comers'>
           <h1>新人专享</h1>
           {newcomers.length==0? <Empty description='暂无数据' />:
          <ul>
            {
               newcomers.map((item) => {
                return <li key={item.id}
                onClick={() => {props.history.push(`/detail/${item.id}/1`)}}
                >
                    <img src={$pre+item.img} alt={item.goodsname}/>
                    <h2>商品名称：{item.goodsname}</h2>
                    <p>原价：{item.market_price}</p>
                    <p>现价：{item.price}</p>
                </li>
               }) 
            }
            
          </ul>

           }
       
        </div>
    )
}
export default withRouter(NewComers)